/*
** prototypes.h for  in /home/gomes_m//rattrapage/server
** 
** Made by mickael gomes
** Login   <gomes_m@epitech.net>
** 
** Started on  Tue Jul 23 13:20:12 2013 mickael gomes
** Last update Wed Jul 31 00:46:15 2013 mickael gomes
*/


#ifndef		        PROTOTYPES_H_
# define		PROTOTYPES_H_

/*
**			Macros
*/

# define		PATH "PATH="
# define		CMD_EXEC "Command executed.\n"
# define		WRONG_PATH "Wrong path aha.\n"
# define		MAX_SIZE 1024

/*
**			file -> xfunctions.c
*/

int			xatoi(char *);
struct protoent		*xgetprotobyname(char *);
int			xsocket(int, int, int);
void			xbind(int, const struct sockaddr *, socklen_t);
void			xlisten(int, int);

/*
**			file -> xfunctions2.c
*/

int		        xaccept(t_socket *);
int			xselect(int, fd_set *, fd_set *, fd_set *, struct timeval *);
void	       		*xmalloc(int);
void			xclose(int);
int			xwrite(int, char *, int);

/*
**			file -> xfunctions3.c
*/

int			xrecv(int, char*, int, int);
void			xfcntl(int, int, int);
int			xgetrlimit();
void			xread(int, char *, int);

/*
**			file -> check_events.c
*/

void			check_event(t_list *, t_socket *);
void			check_new_client(t_socket *, t_list *);
void			check_disconnected(t_list **);

/*
**			file -> communication.c
*/

int			check_cmd(char *);
void			send_response(int *, t_list *);
void			get_cmd(t_list *);

/*
**			file -> treat_cmd.c
*/

int			get_how_many_chars(char *);
char			*treat_buff(char *);
char			*get_first_part(char *);
char			*get_remains(char *);

/*
**			file -> lib.c
*/

void			my_putstr(int, char *, int);
int			my_strlen(char *);
int			my_strcmp(char *, char *);
t_list			*my_put_in_list(t_list *);
int			my_strncmp(char *, char *, int);

/*
**			file -> my_delete_from_list.c
*/

t_list			*option_1(t_list *);
t_list			**option_2(t_list **, int);
int			get_position_in_list(t_list *, int, int);
int			get_list_len(t_list *);
void			my_delete_from_list(t_list **, int);

/*
**			file -> init.c
*/

void			init_socket(t_socket *, int);
void			init_list(t_list *, char **);
void			init_tmp(t_list *);

/*
**			file -> main.c
*/

char			*check_port_validity(char *);
void			get_socket_max(t_socket *, t_list *);

/*
**			file -> commandes.c
*/

void			my_ls(t_list *);
void			show_list(t_list *);

/*
**			file -> my_cd.c
*/

void			go_to_current_dir(char *);
char			*get_previous_dir(t_list *);
char			*check_arg(char *, t_list *);
void			my_cd(t_list *);

/*
**			file -> my_str_to_word_tab_plus.c
*/

char			**my_str_to_wordtab_plus(char *);

/*
**			file -> my_str_to_word_tab.c
*/

char			**my_str_to_wordtab(char *);

/*
**			file -> lib2.c
*/

int			tab_len(char **);
char			*my_strcat_plus(char *, char *, char);

/*
**			file -> treat_env.c
*/

char			**get_env_paths(char **);

/*
**			file -> exec_cmd.c
*/

void			get_fork(t_list *);
void			do_cmd(t_list *);

/*
**			file -> transfert.c
*/

void			get_file(t_list *);

#endif			/* !PROTOTYPES_H_ */
